Hệ thống quản lý trường đại học bằng PHP
1 <?php require('../includes/config.php');
2
3 $stmt = $db->prepare('SELECT postID, postTitle, postCont, postDate, image FROM blog_posts WHERE postID = :postID');
4 $stmt->execute(array(':postID' => $_GET['id']));
5 $row = $stmt->fetch();
6
7 //if post does not exists redirect user.
8 if($row['postID'] == ''){
9 header('Location: ./');
10 exit;
11 }
12
13 ?>
14 <!DOCTYPE html>
15 <html lang="en">
16 <head>
17 <meta charset="utf-8">
18 <meta name="viewport" content="width=device-width, initial-scale=1" />
19 <!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
20 <link rel="stylesheet" href="assets/css/main.css" />
21 <!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
22 <!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
23 <!-- Scripts -->
24 <script src="assets/js/jquery.min.js"></script>
25 <script src="assets/js/skel.min.js"></script>
26 <script src="assets/js/util.js"></script>
27 <!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
28 <script src="assets/js/main.js"></script>
29 </head>
30 <body>
31
32 <div id="wrapper">
33 <?php require('../includes/header.php'); ?>
34 <article class="post">
35 <header>
36 <div class="title">
37 <h2><a href=<?php echo "viewpost.php?id=".$row['postID'] ?>> <?= $row['postTitle'] ?> </a></h2>
38 </div>
39 <div class="meta">
40 <time class="published"><?php echo date('jS M Y H:i:s', strtotime($row['postDate'])) ?></time>
41 </div>
42 </header>
43 <?php
44 if ($row['image'] != "") {
45 echo '<img src="content/'.$row['image'].'" alt="" />';
46 }
47 ?>
48 <p><?php echo $row['postCont'] ?></p>
49 <footer>
50 <ul class="stats">
51 <li><a href="#">General</a></li>
52 <li><a href="#" class="icon fa-heart">28</a></li>
53 <li><a href="#" class="icon fa-comment">128</a></li>
54 </ul>
55 </footer>
56 </article>
57
58 </div>
59
60 </body>
61 </html>